//
//  WithdrawCell.m
//  CBT
//
//  Created by Mr.Zhang on 2018/11/22.
//  Copyright © 2018 Mr.Zhang. All rights reserved.
//

#import "WithdrawCell.h"

@interface WithdrawCell()

@property (nonatomic, strong) UIView *rootView;
@property (nonatomic, strong) UILabel *cbtAbbreviationLabel;
@property (nonatomic, strong) UIView *nameLineView;
@property (nonatomic, strong) UIView *abbLineView;

@end

@implementation WithdrawCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        [self initSubViews];
    }
    
    return self;
}

- (void)initSubViews
{
    __weak WithdrawCell *weakSelf = self;
    
    UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(15, 15, SCREEN_WIDTH - 30, 60)];
    topView.backgroundColor     = [UIColor whiteColor];
    topView.layer.cornerRadius  = 5;
    topView.layer.masksToBounds = YES;
    [self.contentView addSubview:topView];
    
    UIButton *allBtn = [[UIButton alloc]initWithFrame:CGRectMake(topView.width - 69, 0, 69, 60)];
    [allBtn setTitle:kLocalizedString(@"全部",nil) forState:(UIControlStateNormal)];
    [allBtn bk_whenTapped:^{
        weakSelf.cbtNameTextField.text = [NSString stringWithFormat:@"%@",[CBTLocalUserManager sharedInstance].userAsset];
        if (weakSelf.allBtnClickBlock != nil) {
            weakSelf.allBtnClickBlock([NSString stringWithFormat:@"%@",[CBTLocalUserManager sharedInstance].userAsset]);
        }
    }];
    [allBtn setTitleColor:UIColorFromRGB(0x7889ff) forState:(UIControlStateNormal)];
    allBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [topView addSubview:allBtn];
    
    _cbtNameTextField = [[UITextField alloc]initWithFrame:CGRectMake(15, 0, allBtn.left - 15, 60)];
    _cbtNameTextField.font = [UIFont systemFontOfSize:13];
    _cbtNameTextField.placeholder = kLocalizedString(@"请输入划转数量",nil);
    _cbtNameTextField.keyboardType = UIKeyboardTypeDecimalPad;
    _cbtNameTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
    _cbtNameTextField.textColor = UIColorFromRGB(0x7889ff);
    [topView addSubview:_cbtNameTextField];
    
    _cbtInfoLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, topView.bottom + 15, ScreenNarrowSide - 30, 20)];
    _cbtInfoLabel.font = [UIFont systemFontOfSize:12];
    _cbtInfoLabel.textColor = UIColorFromRGB(0xFF2C52);
    _cbtInfoLabel.numberOfLines = 0;
    _cbtInfoLabel.lineBreakMode = NSLineBreakByWordWrapping;
    [self.contentView addSubview:_cbtInfoLabel];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
